package com.zsh.servlet;

import com.zsh.pojo.Student;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class SerachServlet extends HttpServlet {

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //获取请求参数
        //数据库查询

        List<Student> studentList = new ArrayList<Student>();
        for (int i = 0; i < 10 ; i++) {
            studentList.add(new Student(i + 1, "name" + i, 10 + i));
        }
        //请求转发给jsp显示信息
        request.setAttribute("studentList",studentList);

        request.getRequestDispatcher("/test/showStudent.jsp").forward(request,response);
    }
}
